package com.iflytek.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.iflytek.bean.Admin;
import com.iflytek.bean.RansferOrder;
import com.iflytek.service.AdminService;
import com.iflytek.service.OrderService;
import com.iflytek.vo.layuiPage;

@RestController
@RequestMapping("/order")
public class orderController {
	@Autowired
	private OrderService orderService;
	
	//展示
	@GetMapping("/show")
	public Object goodsShow() {

		List<RansferOrder> Page = orderService.selectByExample(null);
		
		layuiPage result = new layuiPage();
		result.setCode(0);
		result.setMsg("");
		result.setData(Page);
		return result;
	}
	
	//新增
	@PostMapping("/add")
	public Object goodsAdd(RansferOrder ransferOrder) {
		orderService.insertSelective(ransferOrder);
		layuiPage page = new layuiPage();
		page.setCode(0);
		page.setMsg("");
		page.setData(ransferOrder);
		return page;
		
	}
	
	//删除
	@GetMapping("/del")
	public Object goodsDelete(Integer orderId) {
		orderService.deleteByPrimaryKey(orderId);
		layuiPage page = new layuiPage();
		page.setCode(0);
		page.setMsg("");
		return page;
	}
	
	
	//更新
	@PostMapping("/edit")
	public Object goodsEdit(RansferOrder ransferOrder) {
		orderService.updateByPrimaryKeySelective(ransferOrder);
		
		layuiPage page = new layuiPage();
		page.setCode(0);
		page.setMsg("");
		page.setData(ransferOrder);
		return page;
	}
	
	
	
	
	
}
